#include "pr/Trainer.h"
#include "pr/Classifier.h"
#include "pr/TrainingSet.h"

namespace pr {

Trainer::Trainer(Classifier& classifier, const TrainingSet& trainingSet)
  : classifier_(classifier)
  , trainingSet_(trainingSet)
{
}

void Trainer::train()
{
  for (std::size_t i = 0; i < trainingSet_.patternCount(); ++i)
  {
    const UniquePattern& trainingPattern = trainingSet_.getPattern(i);
    classifier_.train(trainingPattern.Value, trainingPattern.ClassId);
  }
}

} // namespace pr
